﻿<!--Copyright (c) 2011, thinktecture (http://www.thinktecture.com)
/*
   thinktecture.UIAnnotations was developed by Jörg Neumann.
   Copyright (c) 2011, thinktecture (http://www.thinktecture.com).
   All rights reserved, comes as-is and without any warranty. Use of this
   source file is governed by the license which is contained in LICENSE.TXT 
   in the distribution.
*/-->

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!--Error Template-->
    <ControlTemplate x:Key="BindingErrorTemplate">
        <DockPanel Focusable="False">
            <Image ToolTip="Binding Error"
                   Source="Images/Error.png" 
                   Stretch="None" />
        </DockPanel>
    </ControlTemplate>

    <!--Error Template-->
    <ControlTemplate x:Key="ErrorTemplate">
        <DockPanel Focusable="False">
            <AdornedElementPlaceholder Name="fieldAdorner" />
            <Image ToolTip="{Binding ElementName=fieldAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
                   Source="Images/Error.png" 
                   Stretch="None" Margin="4,0,0,0" />
        </DockPanel>
    </ControlTemplate>
    
    <!--Editor Toolbar Template-->
    <ControlTemplate x:Key="EditorToolbarTemplate">
        <ToolBar Name="PART_Toolbar" Opacity="0.5" BorderBrush="DarkGray" BorderThickness="1" Focusable="False">
            <Button Command="Undo" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" Focusable="False">
                <Image Source="Images/Undo.png" Stretch="None" />
            </Button>
            <Button Command="Redo" ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Command.Text}" Focusable="False">
                <Image Source="Images/Redo.png" Stretch="None" />
            </Button>
            <Button Name="PART_DeleteItem" CommandTarget="{Binding}" ToolTip="{Binding Source={x:Static ApplicationCommands.Delete}, Path=Name}" Focusable="False">
                <Image Source="Images/Delete.png" Stretch="None" />
            </Button>
            <ToolBar.Resources>
                <Style TargetType="Image">
                    <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type Button}, AncestorLevel=1},Path=IsEnabled}" />
                    <Style.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.4"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ToolBar.Resources>
        </ToolBar>
    </ControlTemplate>

    <!--Edit Context Menu-->
    <ContextMenu x:Key="EditContextMenu">
        <MenuItem Command="Undo">
            <MenuItem.Icon>
                <Image Stretch="None" Source="Images/Undo.png" />
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Command="Redo">
            <MenuItem.Icon>
                <Image Stretch="None" Source="Images/Redo.png" />
            </MenuItem.Icon>
        </MenuItem>
        <Separator />
        <MenuItem Command="Cut">
            <MenuItem.Icon>
                <Image Stretch="None" Source="Images/Cut.png" />
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Command="Copy">
            <MenuItem.Icon>
                <Image Stretch="None" Source="Images/copy.png" />
            </MenuItem.Icon>
        </MenuItem>
        <MenuItem Command="Paste">
            <MenuItem.Icon>
                <Image Stretch="None" Source="Images/paste.png" />
            </MenuItem.Icon>
        </MenuItem>
        <Separator />
        <MenuItem Name="PART_DeleteItem" CommandTarget="{Binding}" Header="{Binding Source={x:Static ApplicationCommands.Delete}, Path=Name}">
            <MenuItem.Icon>
                <Image Stretch="None" Source="Images/Delete.png" />
            </MenuItem.Icon>
        </MenuItem>
        <ContextMenu.Resources>
            <Style TargetType="Image">
                <Setter Property="IsEnabled" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type MenuItem}, AncestorLevel=1},Path=IsEnabled}" />
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" Value="0.4"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </ContextMenu.Resources>
    </ContextMenu>

    <!--Highlight on Focus Templates-->
    <ControlTemplate x:Key="HighlightOnFocusTemplates">
        <DockPanel Focusable="False">
            <Border BorderBrush="LightBlue" BorderThickness="4" Opacity="0.7"><!--BorderBrush="#FFEFAA2A"-->
                <Border.Effect>
                    <BlurEffect Radius="7" KernelType = "Gaussian" />
                </Border.Effect>
            </Border>
        </DockPanel>
    </ControlTemplate>

    <!--SmartTag Template-->
    <ControlTemplate x:Key="NormalTemplate" TargetType="{x:Type Button}">
        <Border Width="38" Height="24" Name="PART_Border" UseLayoutRounding="True" SnapsToDevicePixels="True">
            <Border SnapsToDevicePixels="True" UseLayoutRounding="True" Name="PART_ChildBorder" Width="12" Height="3" VerticalAlignment="Bottom" HorizontalAlignment="Left" BorderBrush="Blue" BorderThickness="1" Background="White" />
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="ActivatedTemplate" TargetType="{x:Type Button}">
        <Border Width="38" Name="PART_Border" UseLayoutRounding="True" SnapsToDevicePixels="True">
            <Border UseLayoutRounding="True" SnapsToDevicePixels="True" Name="PART_ChildBorder" Width="38" Height="24" Margin="0,20,0,0" VerticalAlignment="Top" BorderBrush="#FFFFBD69" BorderThickness="1" Background="#FFFFE7A2">
                <Image Name="PART_Image" Source="Images/SmartTag.png" Stretch="None" RenderOptions.BitmapScalingMode="NearestNeighbor" UseLayoutRounding="True" SnapsToDevicePixels="True" />
            </Border>
        </Border>
    </ControlTemplate>

    <ControlTemplate x:Key="SmartTagTemplate">
        <ControlTemplate.Resources>
            <Style x:Key="SmartTagContextMenuStyle" TargetType="{x:Type Button}">
                <Setter Property="Template" Value="{StaticResource ActivatedTemplate}" />
                <Setter Property="UseLayoutRounding" Value="True" />
                <Setter Property="SnapsToDevicePixels" Value="True" />
            </Style>
            <Style x:Key="SmartTagStyle" TargetType="{x:Type Button}">
                <Setter Property="Template" Value="{StaticResource NormalTemplate}" />
                <Setter Property="UseLayoutRounding" Value="True"/>
                <Setter Property="SnapsToDevicePixels" Value="True" />
                <Style.Triggers>
                    <Trigger Property="IsMouseOver" Value="true">
                        <Setter Property="Template" Value="{StaticResource ActivatedTemplate}" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </ControlTemplate.Resources>
        <Button Name="smartTagButton" Style="{StaticResource SmartTagStyle}" UseLayoutRounding="True" SnapsToDevicePixels="True" />
    </ControlTemplate>

</ResourceDictionary>